package cz.muni.fi.pa165.carpark.dao;

import cz.muni.fi.pa165.carpark.EmployeePosition;
import cz.muni.fi.pa165.carpark.entities.Employee;
import java.util.List;

/**
 * This class represents the DAO interface for entity Employee.
 * 
 * @author Martin Derka
 */
public interface EmployeeDAO {

    /**
     * Creates new employee in the database
     * @param employee Entity to be stored. Not to be null, employee.id not to be null
     * @throws IllegalArgumentException when employee is null
     * @throws IllegalArgumentException when employee.id is not null (already stored in the database)
     */
    public void createEmp(Employee employee);

    /**
     * Retrieves an employee from the database by ID
     * @param id Id of the employee to be retrieved, not to be null and to be positive
     * @return Employee as stored in the database
     * @throws IllegalArgumentException when id is null
     * @throws IllegalArgumentException when id is negative
     */
    public Employee retrieveEmp(Long id);

    /**
     * Updates employee in the database. It is expected to already
     * exist. If it does not, an exception is thrown.
     * @param employee Employee to be updated
     * @throws IllegalArgumentException when employee is null
     * @throws IllegalArgumentException when employee.id is null (the employee has not been stored in the database yet)
     */
    public void updateEmp(Employee employee);

    /**
     * Deletes an employee from the database. It is supposed to exist.
     * If it does not exist, an exception is thrown. 
     * @param employee Employee to be deleted
     * @throws IllegalArgumentException when employee is null
     * @throws IllegalArgumentException when employee.id is null (the employee is not in the database)
     */
    public void deleteEmp(Employee employee);
    
    /**
     * Retrieves all employees from the database
     * @return List of employees stored in the database
     */
    public List<Employee> retrieveAll();
    
    /**
     * Retrieves all employees from the database with the given position
     * @param position Position of the employee
     * @return List of employees stored in the database with the given position
     */
    public List<Employee> retrieveByCategory(EmployeePosition position);
}
